﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MySql.Data.MySqlClient;

namespace auxiliary_proj
{
    public partial class FormLogin : Form
    {
        public FormLogin()
        {
            InitializeComponent();
            tbUser.Focus();
            this.FormClosing+=new FormClosingEventHandler(FormLogin_FormClosing); //Form Closing Event Handler
        }

        private void btnLoginSettings_Click(object sender, EventArgs e)
        {
            FormSettings fs = new FormSettings();
            fs.StartPosition = FormStartPosition.CenterScreen;
            fs.Show();
        }
        
        private void btnLogin_Click(object sender, EventArgs e)
        {
            //parse server info
            Program.parseServerInfo();
            //User Login
            Employee.login(this.tbUser.Text, this.tbPass.Text);
            this.Dispose();
            Singleton.getMainForm().Opacity = .99;
        }

        private void FormLogin_FormClosing(object sender, FormClosingEventArgs e)
        {
            Singleton.getMainForm().Opacity = .99; //Change the opacity of the form once the form is closed
        }
    }
}
